#include<stdio.h>
#include<sys/types.h>
#include<unistd.h>

int main()
{
    pid_t id=fork();
    while(1)
	{
        printf("这是一个用于打印进程的pid与ppid的试代码\n");
		printf("pid:%d\n",getpid());
		printf("ppid:%d\n",getppid());
		if(id >0)
        {
            printf("father doing sth\n");
        }
        else if(id == 0)
        {
            //等于0，说明是子进程
            printf("son doing sth\n");
        }
        sleep(1);
	}


	return 0;
}

